//
//  YDActivity.m
//  IngCard
//
//  Created by kf on 2017/9/8.
//  Copyright © 2017年 IngDan. All rights reserved.
//

#import "YDActivity.h"

@implementation YDActivity

+(YDActivity *) serializeWithJson:(NSDictionary *) dic
{
    if (!dic) return nil;
    
    YDActivity *result = [YDActivity new];

    result.ID = NSStringMake(dic[@"activity_id"]);
    result.type = (YDActivityType)NSStringMake(dic[@"activity_type"]).intValue;
    result.content = NSStringMake(dic[@"description"]);
    result.createTime = NSStringMake(dic[@"creat_time"]);
    
    NSArray *contactsJson = NSArrayMake(dic[@"list"]);
    result.contacts = [YDContact serializeWithListJson:contactsJson];
    
    return result;
}

+(YDActivity *) serializeWithSyncJson:(NSDictionary *) dic
{
    if (!dic) return nil;
    
    YDActivity *result = [YDActivity new];
    
    result.ID = NSStringMake(dic[@"aid"]);
    result.type = YDActivity_card;//(YDActivityType)NSStringMake(dic[@"activity_type"]).intValue;
//    result.content = NSStringMake(dic[@"description"]);
    result.createTime = NSStringMake(dic[@"create_time"]);
    
    NSArray *contactsJson = NSArrayMake(dic[@"list"]);
    result.contacts = [YDContact serializeWithListJson:contactsJson];
    [result.contacts addObjectsFromArray: [YDContact serializeWithListJson:contactsJson]];
    
    [result.contacts addObjectsFromArray: [YDContact serializeWithListJson:contactsJson]];
    return result;
}

@end


@implementation YDExchageInfo
@end
